<?php if(!filter_has_var(INPUT_GET,'id')){exit(json_encode(['status'=>'error','data'=>['msg'=>'指定模板不存在-01'],]));}$template=new Zmsun\System\Template\Template(Zmsun\System\System::templateDir().$_GET['id']);$errorMsg='';if(!file_exists($template->configFile())){$errorMsg='指定模板不存在-02';}else{$cache=new Zmsun\System\Cache();$cache->del($cache::CACHE_TEMPLATE|$cache::CACHE_SYSTEM);$userConfig=Zmsun\System\System::userConfig();$userConfig->template=$_GET['id'];if(false===$userConfig->asXML(Zmsun\System\System::userConfigFile())){$errorMsg="切换模板失败";}else{(new Zmsun\SEO\Sitemap($this->getServiceManager()))->unlink(Zmsun\SEO\Sitemap::TYPE_PC);}}echo json_encode(['status'=>$errorMsg ?'error':'ok','data'=>['msg'=>$errorMsg]]);?>